<?php

// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库：https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库：https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------

namespace app\index\controller;

use think\admin\Controller;


/**
 * Class Aboutus
 * @package app\index\controller
 */
class Product extends BaseController
{

    static private $category_id = 2;
    static public $limit = 6;
    public $table = "CmsQiyeProduct";

    public function index()
    {
        $this->current_nav = "product";
        $this->kw = $this->intro = $this->request->get("kw");
        $this->page = intval($this->request->get("page",1));
        $pager = $this->_prepare_product_page_info($this->kw,self::$limit);
        $offset = ($this->page-1)*self::$limit;

        $query = $this->app->db->name($this->table)
            ->whereLike("name","%".$this->kw."%");
        $list = $query->order("id desc")->limit($offset,self::$limit)->select()->toArray();

        $this->product = array(
            "info" => $this->_get_category(self::$category_id), //栏目
            "list" => $list,
            "pager" => $pager,
        );
        $this->title = $this->product['info']['title'];

        $this->_get_nav_menus();
        $this->_system();
        $this->fetch();
    }



}